home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / www / src / WWW / Library / Implementation / HTAccess.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-20  |  6.6 KB  |  287 lines

  1. /*                                                      HTAccess:  Access manager  for libwww
  2.                                       ACCESS MANAGER
  3.                                              
  4.    This module keeps a list of valid protocol (naming scheme) specifiers with associated
  5.    access code.  It allows documents to be loaded given various combinations of
  6.    parameters. New access protocols may be registered at any time.
  7.    
  8.    Part of the libwww library .
  9.    
  10.  */
  11. #ifndef HTACCESS_H
  12. #define HTACCESS_H
  13.  
  14. /*      Definition uses:
  15. */
  16. #include "HTUtils.h"
  17. #include "tcp.h"
  18. #include "HTAnchor.h"
  19. #include "HTFormat.h"
  20.  
  21. #ifdef SHORT_NAMES
  22. #define HTClientHost            HTClHost
  23. #define HTSearchAbsolute        HTSeAbso
  24. #define HTOutputStream          HTOuStre
  25. #define HTOutputFormat          HTOuForm
  26. #endif
  27.  
  28. /*      Return codes from load routines:
  29. **
  30. **      These codes may be returned by the protocol modules,
  31. **      and by the HTLoad routines.
  32. **      In general, positive codes are OK and negative ones are bad.
  33. */
  34.  
  35. #define HT_NO_DATA -9999        /* return code: OK but no data was loaded */
  36.                                 /* Typically, other app started or forked */
  37.  
  38. /*
  39.  
  40. Default Addresses
  41.  
  42.    These control the home page selection. To mess with these for normal browses is asking
  43.    for user confusion.
  44.    
  45.  */
  46. #define LOGICAL_DEFAULT "WWW_HOME"  /* Defined to be the home page */
  47.  
  48. #ifndef PERSONAL_DEFAULT
  49. #define PERSONAL_DEFAULT "WWW/default.html"     /* in home directory */
  50. #endif
  51. #ifndef LOCAL_DEFAULT_FILE
  52. #define LOCAL_DEFAULT_FILE "/usr/local/lib/WWW/default.html"
  53. #endif
  54. /*  If one telnets to a www access point,
  55.     it will look in this file for home page */
  56. #ifndef REMOTE_POINTER
  57. #define REMOTE_POINTER  "/etc/www-remote.url"  /* can't be file */
  58. #endif
  59. /* and if that fails it will use this. */
  60. #ifndef REMOTE_ADDRESS
  61. #define REMOTE_ADDRESS  "http://info.cern.ch/remote.html"  /* can't be file */
  62. #endif
  63.  
  64. /* If run from telnet daemon and no -l specified, use this file:
  65. */
  66. #ifndef DEFAULT_LOGFILE
  67. #define DEFAULT_LOGFILE "/usr/adm/www-log/www-log"
  68. #endif
  69.  
  70. /*      If the home page isn't found, use this file:
  71. */
  72. #ifndef LAST_RESORT
  73. #define LAST_RESORT     "http://info.cern.ch/default.html"
  74. #endif
  75.  
  76.  
  77. /*
  78.  
  79. Flags which may be set to control this module
  80.  
  81.  */
  82. extern int HTDiag;                      /* Flag: load source as plain text */
  83. extern char * HTClientHost;             /* Name or number of telnetting host */
  84. extern FILE * logfile;                  /* File to output one-liners to */
  85. extern BOOL HTSecure;                   /* Disable security holes? */
  86. extern HTStream* HTOutputStream;        /* For non-interactive, set this */
  87. extern HTFormat HTOutputFormat;         /* To convert on load, set this */
  88.  
  89.  
  90.  
  91. /*
  92.  
  93. Load a document from relative name
  94.  
  95.   ON ENTRY,
  96.   
  97.   relative_name           The relative address of the file to be accessed.
  98.                          
  99.   here                    The anchor of the object being searched
  100.                          
  101.   ON EXIT,
  102.   
  103.   returns    YES          Success in opening file
  104.                          
  105.   NO                      Failure
  106.                          
  107.  */
  108. extern  BOOL HTLoadRelative PARAMS((
  109.                 CONST char *            relative_name,
  110.                 HTParentAnchor *        here));
  111.  
  112.  
  113. /*
  114.  
  115. Load a document from absolute name
  116.  
  117.   ON ENTRY,
  118.   
  119.   addr                    The absolute address of the document to be accessed.
  120.                          
  121.   filter                  if YES, treat document as HTML
  122.                          
  123.  */
  124.  
  125. /*
  126.  
  127.   ON EXIT,
  128.   
  129.  */
  130.  
  131. /*
  132.  
  133.   returns YES             Success in opening document
  134.                          
  135.   NO                      Failure
  136.                          
  137.  */
  138. extern BOOL HTLoadAbsolute PARAMS((CONST char * addr));
  139.  
  140.  
  141. /*
  142.  
  143. Load a document from absolute name to a stream
  144.  
  145.   ON ENTRY,
  146.   
  147.   addr                    The absolute address of the document to be accessed.
  148.                          
  149.   filter                  if YES, treat document as HTML
  150.                          
  151.   ON EXIT,
  152.   
  153.   returns YES             Success in opening document
  154.                          
  155.   NO                      Failure
  156.                          
  157.    Note: This is equivalent to HTLoadDocument
  158.    
  159.  */
  160. extern BOOL HTLoadToStream PARAMS((CONST char * addr, BOOL filter,
  161.                                 HTStream * sink));
  162.  
  163.  
  164. /*
  165.  
  166. Load if necessary, and select an anchor
  167.  
  168.   ON ENTRY,
  169.   
  170.   destination                The child or parenet anchor to be loaded.
  171.                          
  172.  */
  173.  
  174. /*
  175.  
  176.   ON EXIT,
  177.   
  178.  */
  179.  
  180. /*
  181.  
  182.   returns YES             Success
  183.                          
  184.   returns NO              Failure
  185.                          
  186.  */
  187.  
  188.  
  189.  
  190. extern BOOL HTLoadAnchor PARAMS((HTAnchor * destination));
  191.  
  192.  
  193. /*
  194.  
  195. Make a stream for Saving object back
  196.  
  197.   ON ENTRY,
  198.   
  199.   anchor                  is valid anchor which has previously beeing loaded
  200.                          
  201.   ON EXIT,
  202.   
  203.   returns                 0 if error else a stream to save the object to.
  204.                          
  205.  */
  206.  
  207.  
  208. extern HTStream * HTSaveStream PARAMS((HTParentAnchor * anchor));
  209.  
  210.  
  211. /*
  212.  
  213. Search
  214.  
  215.    Performs a search on word given by the user. Adds the search words to the end of the
  216.    current address and attempts to open the new address.
  217.    
  218.   ON ENTRY,
  219.   
  220.   *keywords               space-separated keyword list or similar search list
  221.                          
  222.   here                    The anchor of the object being searched
  223.                          
  224.  */
  225. extern BOOL HTSearch PARAMS((CONST char * keywords, HTParentAnchor* here));
  226.  
  227.  
  228. /*
  229.  
  230. Search Given Indexname
  231.  
  232.    Performs a keyword search on word given by the user. Adds the keyword to  the end of
  233.    the current address and attempts to open the new address.
  234.    
  235.   ON ENTRY,
  236.   
  237.   *keywords               space-separated keyword list or similar search list
  238.                          
  239.   *indexname              is name of object search is to be done on.
  240.                          
  241.  */
  242. extern BOOL HTSearchAbsolute PARAMS((
  243.         CONST char *    keywords,
  244.         CONST char *    indexname));
  245.  
  246.  
  247. /*
  248.  
  249. Register an access method
  250.  
  251.  */
  252.  
  253. typedef struct _HTProtocol {
  254.         char * name;
  255.         
  256.         int (*load)PARAMS((
  257.                 CONST char *    full_address,
  258.                 HTParentAnchor * anchor,
  259.                 HTFormat        format_out,
  260.                 HTStream*       sink));
  261.                 
  262.         HTStream* (*saveStream)PARAMS((HTParentAnchor * anchor));
  263.  
  264. } HTProtocol;
  265.  
  266. extern BOOL HTRegisterProtocol PARAMS((HTProtocol * protocol));
  267.  
  268.  
  269. /*
  270.  
  271. Generate the anchor for the home page
  272.  
  273.  */
  274.  
  275. /*
  276.  
  277.    As it involves file access, this should only be done once when the program first runs.
  278.    This is a default algorithm -- browser don't HAVE to use this.
  279.    
  280.  */
  281. extern HTParentAnchor * HTHomeAnchor NOPARAMS;
  282.  
  283. #endif /* HTACCESS_H */
  284. /*
  285.  
  286.    end of HTAccess  */
  287.